Automatically Proving the Termination of Functional Programs

نویسنده

  • Daron Vroon
چکیده

ion of the actual system. We use CCGs to perform a local analysis which, if successful, can determine that the definitions terminate. To do this, we start by assigning calling context measures to contexts in the CCG. 8.4 Calling Context Measures and Termination Definition 8.4.1. Given a calling context, c = 〈f,G, e〉, and a set S ⊆ Val , the set of calling context measures (CCMs) for c over S, denoted CCM c S is the set {e ∈ Expr | 〈∀ ∈ Env : Hh JGK : free(e) ⊆ {xf1 , . . . x f ar(f)} ∧ JeK h ∈ S〉}. CCMs simply map the parameters of a function into some set. We annotate CCGs with CCMs using a CCM annotation. Definition 8.4.2. Given a set of calling contexts, C, and a set, S ⊆ Val , a CCM annotation for C over S is a function m : C → P(Expr) such that 〈∀c ∈ C :: m(c) ⊆ CCM c S〉. Now we create a mechanism for comparing the CCM of two adjacent contexts in a CCG. Definition 8.4.3. Let G = (C,E) be a CCG with e = 〈c1, c2〉 ∈ E, such that c1 = 〈f1, G1, e1〉 and c2 = 〈f2, G2, e2〉, where e1 = (f2 e1,1 . . . e1,ar(f2)). Let 〈S,≺〉 be a wellfounded structure, and m : C → P(Expr) be a CCM annotation for C over S. Then a CCM function (CCMF) for e with annotation m and order ≺ is a function φc1 c2 : m(c1)×m(c2)→ {>,≥,×} such that φ(s1, s2) = > only if 〈∀ ∈ Env : 〈∀i : 1 ≤ i ≤ ar(f2) : Je1,iK 6= ⊥〉 ∧ H JG1 ∪G2σe1K : Js1K Js2σe1K 〉 and φ(s1, s2) = ≥ only if 〈∀ ∈ Env : 〈∀i : 1 ≤ i ≤ ar(f2) : Je1,iK 6= ⊥〉 ∧ H JG1 ∪G2σe1K : Js1K Js2σe1K 〉. We represent CCM functions for 〈c1, c2〉 graphically with a box containing the CCMs for c1, c2 on the left and right, respectively. An edge is drawn from s1, a left CCM, to s2, a right CCM, with the label φ(s1, s2) iff it is > or ≥. If φ(s1, s2) is ×, no edge is drawn. We now consider some examples. For the function f in Figure 23 on page 85, we use the acl2-count function in Figure 25 on the next page applied to f’s parameter, x, as the only CCM for both contexts. The range of acl2-count is the set of natural numbers, and the function is designed to mirror common induction schemes, e.g., induction on the size of a list. Notice that for each context in our example, the CCM decreases for all values

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

توسعه روش SL با ترتیب KBO برای اثبات خودکار پایان‌پذیری سیستم بازنویسی ترم - مقاله برگزیده هفدهمین کنفرانس ملی انجمن کامپیوتر ایران

 The term rewriting systems (TRSs) is an abstract model of functional languages. The termination proving of TRSs is necessary for confirming accuracy of functional languages. The semantic labeling (SL) is a complete method for proving termination. The semantic part of SL is given by a quasi-model of the rewrite rules. The most power of SL is related to infinite models that is difficult f...

متن کامل

Termination Analysis with Calling Context Graphs

We introduce calling context graphs and various static and theorem proving based analyses that together provide a powerful method for proving termination of programs written in feature-rich, first order, functional programming languages. In contrast to previous work, our method is highly automated and handles any source of looping behavior in such languages, including recursive definitions, mut...

متن کامل

Automated termination analysis for logic programs with cut

Termination is an important and well-studied property for logic programs. However, almost all approaches for automated termination analysis focus on definite logic programs, whereas real-world Prolog programs typically use the cut operator. We introduce a novel pre-processing method which automatically transforms Prolog programs into logic programs without cuts, where termination of the cut-fre...

متن کامل

Proving Termination and Memory Safety for Programs with Pointer Arithmetic

Proving termination automatically for programs with explicit pointer arithmetic is still an open problem. To close this gap, we introduce a novel abstract domain that can track allocated memory in detail. We use it to automatically construct a symbolic execution graph that represents all possible runs of the program and that can be used to prove memory safety. This graph is then transformed int...

متن کامل

Termination of Logic Programs via Labelled Term Rewrite Systems

We propose automatically proving termination of logic programs by transforming them into term rewrite systems (TRS). We describe such a transformation for which termination of the logic program follows from innermost termination of the TRS, which is stronger than previous results. Semantic labelling turns out to be a powerful tool for proving termination of this kind of TRSs: we use it to prove...

متن کامل

Termination Analysis for Logic Programs

I survey termination analysis of logic programs with particular attention to methods for automatically proving termination. I introduce the central concepts of automatic termination analysis and give an overview of the research on other types of termination analysis. I describe the main approaches covered in the literature and compare the accuracy and eeciency of each of them.

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2007